 <script type="text/javascript">
$(function () {
	var url = '${contextPath}script/oa/apply.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			
		}
	});
});
</script>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div class="widget-header">
		<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑申请信息</h3>
</div>
<div class="widget" >
	<div class="widget-content">
		<form id="editApplyForm">
			<table class="table table-bordered animate2 fadeInUp" style="width:400px; text-align:left;">
				<tr>
					<th class="table-left" style="width:60px;">标题</th>
					<td><input type="text" id="title" name="title" value="${(apply.title)!''}" placeholder="标题可自动生成 无需填写"/>
						<input type="hidden" id="code" name="code" value="${(apply.code)!''}" /></td>
				</tr>
				<tr>
					<th class="table-left" style="width:60px;">申请类型</th>
					<td>
						<select id="sort" name="sort" class="not-null">
							<option value="1">消耗品</option>
							<option value="2">固定资产</option>
						</select>
					</td>
				</tr>
				<tr><th class="table-left" style="width:60px;">备注</th>
				<td><textarea id="remark" name="remark" value="${(apply.remark)!''}"/></td></tr>
			</table>
			<table style="width:400px; margin-top:10px;" class="table table-bordered animate2 fadeInUp">
				<thead>
					<tr>
						<th style="text-align:center; width:120px;">物品名称<a href="javascript:;" onclick="javascript:addApplyDetail_apply();return false;" style="margin-left: 20px">[添加空白行]</a></th>
						<th style="text-align:center; width:40px;">数量</th>
						<th style="text-align:center; width:40px;">单价</th>
						<th style="width:32px;">操作</th>
					</tr>
				</thead>
				<tbody id="applyDetailListBody">
					<#assign i = 0 />
					<#if ((apply.adList)?? && apply.adList?size > 0)>
					<#list apply.adList as item>
					<tr class="rep">
						<td><input type="text" name="adList[${i}].gn" value="${(item.gn)!''}" class="gn" onblur="javascript:createTitle_apply();return false;"/>
							<input type="hidden" name="adList[${i}].code" value="${(item.code)!''}" /></td>
						<td><input class="cou" type="text" name="adList[${i}].count" value="${(item.count)!''}" onblur="javascript:createTitle_apply();return false;" style="width:40px;"/></td>
						<td><input class="u" type="text" name="adList[${i}].price" value="${(item.price)!''}" onblur="javascript:createTitle_apply();return false;" onkeyup="javascript:checkNum_apply($(this));return false;" style="width:40px;"/></td>
						<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:deleteApplyDetail_apply($(this));return false;"><i class="icon-remove"></i></a></td>
					</tr>
					<#assign i = i + 1/></#list><#else>
					<tr class="rep">
						<td><input type="text" name="adList[${i}].gn" class="gn not-null" onblur="javascript:createTitle_apply();return false;"/></td>
						<td><input class="cou not-null" type="text" name="adList[${i}].count" style="width:40px;" onblur="javascript:createTitle_apply();return false;" onkeyup="javascript:checkNum_apply($(this));"/></td>
						<td><input class="u not-null" type="text" name="adList[${i}].price" onblur="javascript:createTitle_apply();return false;" style="width:40px;"/></td>
						<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:deleteApplyDetail_apply($(this));return false;"><i class="icon-remove"></i></a></td>
					</tr>
					<#assign i = i + 1/></#if>
				</tbody>
				<tr>
					<td colspan="5" style="text-align:center;">
						<a class="btn btn-info" href="javascript:;" onclick="javascript:saveApply_apply();return false;"><i class="icon-save"></i> 保 存</a>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a class="btn btn-primary" href="javascript:;" onclick="javascript:sys_load_handle('apply');return false;"><i class="icon-block"></i> 取 消</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
<input type="hidden" id="index" value="${i}" />
<table id="tempApplyDetailTable" style="display:none;">
	<tr class="rep">
		<td><input class="gn" type="text" onblur="javascript:createTitle_apply();"/></td>
		<td><input class="cou" type="text" style="width:40px;" onblur="javascript:createTitle_apply();" onkeyup="javascript:checkNum_apply($(this)); return false;"/></td>
		<td><input class="u" type="text" style="width:40px;" onblur="javascript:createTitle_apply(); return false;"/></td>
		<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:deleteApplyDetail_apply($(this));return false;"><i class="icon-remove"></i></a></td>
	</tr>
</table>
